"""
    This file is part of Athedyn's Tale.

    Athedyn's Tale is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Athedyn's Tale is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Athedyn's Tale.  If not, see <http://www.gnu.org/licenses/>.
"""

from rpgObject import rpgObject

class ACommands(rpgObject):
    def slash(self, args):
        print "You attempt to slash your opponent."
        if not int(self.objects['items'].statistics['weaponType'][self.objects['user'].statistics['weapon']][0]) == 3:
            damageModifier = self.objects['items'].checkType(self.objects['user'].statistics['weapon'], 1)
            self.statistics['typeOfAttack'] = 1
            self.objects['attack'].hit(damageModifier)
            self.objects['main'].playSound('slash.wav')
            return 1
        else:
            print "You can't slash with this."
        return 0
        
    def stab(self, args):
        print "You attempt to stab your opponent."
        if not int(self.objects['items'].statistics['weaponType'][self.objects['user'].statistics['weapon']][0]) == 3:
            damageModifier = self.objects['items'].checkType(self.objects['user'].statistics['weapon'], 2)
            self.statistics['typeOfAttack'] = 2
            self.objects['attack'].hit(damageModifier)
            self.objects['main'].playSound('stab.wav')
            return 1
        else:
            print "You can't stab with this."
        return 0
        
    def bludgeon(self, args):
        print "You attempt to bludgeon your opponent."
        if int(self.objects['items'].statistics['weaponType'][self.objects['user'].statistics['weapon']][0]) == 3:
            damageModifier = self.objects['items'].checkType(self.objects['user'].statistics['weapon'], 3)
            self.statistics['typeOfAttack'] = 3
            self.objects['attack'].hit(damageModifier)
            return 1
        else:
            print "You can't use this to bludgeon."
        return 0
        
    def strike(self, args):
        print "You attempt to strike your opponent."
        damageModifier = .75
        self.statistics['typeOfAttack'] = 4
        self.objects['attack'].hit(damageModifier)
        return 1
    
    def defend(self,args):
        print "You defended"
        return 1
        
    def run(self, args):
        print "You ran away"
        return 0
        
    
    def help(self, args):
        print "The commands available are: "
        commands = ""
        for key, function in self.objects['attack'].commands.items():
            commands = commands + " " + key
        print commands
        return 0